1 using UnityEngine;
2 using
System.Collections;
3
4 public
class InstantiateCube : MonoBehaviour
5 {
6     
public GameObject Prefab;
7     
public int InstantiateType;
8     
//private string[] InstantiateTypeNames = {"Mine", "Scene"};
9
10     
public bool showGui;
11
12     
void OnClick()
13     {
14         
if (PhotonNetwork.connectionStateDetailed != PeerState.Joined)
15         {
16             
// only use PhotonNetwork.Instantiate while in a room.
17             
return;
18         }
19
20         
switch (InstantiateType)
21         {
22             
case 0:
23                 PhotonNetwork.Instantiate(Prefab.name,
this.transform.position + 3*Vector3.up, Quaternion.identity, 0);
24                 
break;
25             
case 1:
26                 PhotonNetwork.InstantiateSceneObject(Prefab.name, InputToEvent.inputHitPos +
new Vector3(0, 5f, 0), Quaternion.identity, 0, null);
27                 
break;
28         }
29     }
30
31 }


private string[] InstantiateTypeNames = {"Mine", "Scene"};

only use PhotonNetwork.Instantiate while in a room.




Trò chơi Tic-Tac-Toe, game đánh caro full source code 53.433 lượt xem

Gõ tìm kiếm nhanh...